package com.ityy.ruiji.dao;

import com.ityy.ruiji.entity.Setmeal;
import com.ityy.ruiji.entity.dto.SetmealDto;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface SetmealDao {
    @Select("SELECT COUNT(*) FROM setmeal WHERE category_id =#{id}")
    Long findCountByCategoryId(Long id);

    @Insert("insert into setmeal values(null,#{categoryId},#{name},#{price},#{status},#{code},#{description},#{image},#{createTime},#{updateTime},#{createUser},#{updateUser},0)")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    void save(SetmealDto setmealDto);

    List<Setmeal> page(@Param("name") String name);

    //根据ids删除套餐
    void deleteByIds(@Param("ids") List<Long> ids);

    Long findCountByIds(@Param("ids")List<Long> ids);

    List<Setmeal> findById(@Param("categoryId") Long categoryId,@Param("status") Integer status);
}
